import request from '@/utils/request'

export default {

  //获取企业List
  getInternshipList(current, limit, userQuery) {
    return request({
      url: `/intern/internship-info/list/${current}/${limit}`,
      method: 'post',
      //userQuery条件对象，后端使用RequestBody获取数据
      //data表示把对象转换json进行传递到接口里面
      data: userQuery
    })
  },

  //获取简单的企业List （远程搜索使用）
  getSampleInternshipList() {
    return request({
      url: `/intern/internship-info/list`,
      method: 'get'
    })
  },

  //添加实习单位
  addInternship(internship) {
    return request({
      url: `/intern/stu-internship/add`,
      method: 'post',
      data: internship
    })
  },

  //添加实习单位对应学生
  addStuIntern(sid, iid) {
    return request({
      url: `/intern/stu-internship/addStuIntern`,
      method: "post",
      data: {
        sid,
        iid
      }
    })
  },

  //获取当前实习单位的学生列表
  getStuListByIid(iid) {
    return request({
      url: `/intern/stu-internship/stuListByIID/${iid}`,
      method: "get"
    })
  },

  //通过sid移除学生企业表
  deleteStuIntern(sid) {
    return request({
      url: `/intern/stu-internship/removeStuIntern/${sid}`,
      method: 'delete'
    })
  },

  //删除实习单位
  deleteIntern(iid) {
    console.log(iid)
    return request({
      url: `/intern/stu-internship/delete/${iid}`,
      method: 'delete'
    })
  },


  //根据iid 获取对应的企业
  getInternship(iid) {
    //todo 
    return request({
      url: `/intern/internship-info/getInternship/${iid}`,
      method: "get"
    })
  },

  //上传企业Excel 
  addInternshipExcel(data) {
    return request({
      url: '/EasypoiSingleExcelViewTest/importExcelInternship',
      method: "post",
      data: data
    })
  },
  updateInternInfo(user) {
    return request({
      url: '/intern/internship-info/updateInternInfo',
      method: 'post',
      data: user
    })
  }
}
